package com.fortressweb.servlet;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/fortress/fortresswriteform.nhn")
public class FortressBoardWriteFormServlet extends HttpServlet{

		private static final long serialVersionUID = 1L;

		protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
			
			//로그인 상태가 아닌 경우 로그인 페이지로 이동
			if (request.getSession().getAttribute("loginuser") == null) {
				response.sendRedirect(
					"/demoweb/fortress/fortressLoginForm.nhn?" + 
					"returnuri=" + request.getRequestURI());
				return;
			}
			
			RequestDispatcher dispatcher = 
				request.getRequestDispatcher("/WEB-INF/views/fortress/fortressboardwriteform.jsp");

			dispatcher.forward(request, response);
		}

		protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
			doGet(request, response);
		}
}
